package rdobson.management.projectclock;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

public class DatabaseController {
	String TAG = "DatabaseController";
	private DatabaseHelper dbh;
	private Context c;
	
	public DatabaseController(Context c){
		this.c = c;
	}
	
	public void removeAndInstallTables(){
		dbh = new DatabaseHelper(c);
		SQLiteDatabase db = dbh.getWritableDatabase();
		dbh.dropTables(db);
		dbh.createTables(db);
		db.close();
	}
	
	public int getPhotoNumber(){
		SQLiteDatabase db = (new DatabaseHelper(c)).getReadableDatabase();
		Cursor result = db.rawQuery("SELECT value FROM program_values WHERE title='photoNum'",null);
		result.moveToFirst();
		int value = result.getInt(0);
		db.close();
		return value;
	}
	
	
	public void storeTimeMarker(TimeMarker tm){
		SQLiteDatabase db = (new DatabaseHelper(c)).getWritableDatabase();
		
		ContentValues values = new ContentValues(2);
		values.put("project_code", "");
		values.put("date_time", "");
		
		db.insert("locations", "long", values);
		db.close();
	}
	

	
}
